package com.wifi.a007.utile;

import android.text.TextUtils;
import android.util.Log;

import com.google.gson.Gson;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;

import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okio.BufferedSink;


public class HttpUtil {


    public static void sendOkHttpGetRequest(String address, okhttp3.Callback callback){

        OkHttpClient client = new OkHttpClient();
        Request request=new Request.Builder().url(address).build();


        client.newCall(request).enqueue(callback);






    }
    public static void sendOkHttpRequest(String address,okhttp3.Callback callback){

        OkHttpClient client = new OkHttpClient();
        Request request=new Request.Builder().url(address).build();
        client.newCall(request).enqueue(callback);






    }
    public static void sendOkHttpPostRequest(String address, okhttp3.Callback callback){


        OkHttpClient client = new OkHttpClient();
        Request request=new Request.Builder().post(new RequestBody() {
            @Override
            public MediaType contentType() {
                return null;
            }

            @Override
            public void writeTo(BufferedSink sink) throws IOException {

            }
        }).url(address).build();


        client.newCall(request).enqueue(callback);






    }



}
